package com.hfi.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hfi.mapper.EmployeeMapper;
import com.hfi.model.Employee;
import com.hfi.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ChangLiang
 * @since 2019-05-30
 */
@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements IEmployeeService {

    @Autowired
    private EmployeeMapper employeeMapper;

    @Override
    public int deleteAllEmployee() {
//        int delete = employeeMapper.delete(new UpdateWrapper<Employee>().ne("id",0));
        int delete = employeeMapper.delete(null);
        return delete;
    }

    @Override
    public int updateEmpByOptimisticLock(Employee employee) {
        return employeeMapper.updateById(employee);
    }

    @Override
    public void deleteAll() {
        employeeMapper.deleteAll();
    }


}
